package com.zhl.scheduling.model.bo;

import com.zhl.scheduling.model.entity.User;
import lombok.Data;

/**
 * @Author: ZhangLu In DLUT
 * @since: 1.0.0
 * @Description: 登录状态实体类
 */
@Data
public class LoginStatusBO {


    private Boolean loggedIn = false;
    private Integer userId;
    private String username;
    private String userImg;
    private Integer userType;

    public static LoginStatusBO fromUserInfo(User user) {
        LoginStatusBO loginStatus = new LoginStatusBO();
        loginStatus.loggedIn = true;
        loginStatus.userId = user.getUserId();
        loginStatus.username = user.getUsername();
        loginStatus.userType = user.getUserRole();
        loginStatus.userImg = user.getUserImg();

        return loginStatus;
    }
}
